using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest2.Entitys
{
    /// <summary>
    /// 连接参数
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='连接参数']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class AppLinkArg
    {
        /// <summary>
        /// arg_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary(Automatic = true)]
        public int ArgId { get; set; }

        [JsonConverter(typeof(AutoEnumConverter))]
        public ArgTypeEnum ArgTypeName => (ArgTypeEnum)ArgType;

        /// <summary>
        /// 参数类型 [接口,选项,文本,日期,数字]
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '参数类型 [接口,选项,文本,日期,数字]']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("参数类型")]
        public int ArgType { get; set; }

        /// <summary>
        /// 参数名称
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '参数名称']]>
        /// </remarks>
        [Column(64)]
        [DisplayName("参数名称")]
        public string ArgName { get; set; }

        /// <summary>
        /// 接口地址
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '接口地址']]>
        /// </remarks>
        [Column(255)]
        [DisplayName("接口地址")]
        public string ApiUrl { get; set; }

        /// <summary>
        /// 选项  *jarray*
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(512) DEFAULT NULL COMMENT '选项  *jarray*']]>
        /// </remarks>
        [Column(512)]
        [DisplayName("选项")]
        public JArray Options { get; set; }

        /// <summary>
        /// 多选项
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '多选项']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("多选项")]
        public bool IsMultiple { get; set; }

        /// <summary>
        /// remark
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column(255)]
        public string Remark { get; set; }

    }
}
